package com.itheima.manager;

import com.itheima.domain.SmsHomeBrand;
import com.itheima.exception.BusinessException;
import com.itheima.service.db.SmsHomeBrandService;
import com.itheima.util.R;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author ChenTianSui
 * @date 2022/11/12 20:06
 */
@Component
public class SmsHomeBrandManager {
    @DubboReference
    private SmsHomeBrandService homeBrandService;

    public R create(List<SmsHomeBrand> smsHomeBrand) {
        return R.success(homeBrandService.create(smsHomeBrand));

    }

    public R delete(List<Integer> ids) {
        return R.success(homeBrandService.delete(ids));

    }


    public R updateSortById(Integer id, Integer sort) {
        Integer statue = homeBrandService.updateSortById(id, sort);
        if (statue == null) {
            throw new BusinessException("操作有误");
        }
        return R.success(statue);
    }
}
 
